package com.boliq.demo;

import androidx.appcompat.app.AppCompatActivity;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.w3c.dom.Text;
import java.io.Console;

public class LoginActivity extends AppCompatActivity implements View.OnClickListener{
    EditText m1;
    EditText m2;
    Button setBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        m1 = (EditText) findViewById(R.id.edit1_text);
        m2 = (EditText) findViewById(R.id.edit2_text);
        setBtn =(Button)findViewById(R.id.button1);
        setBtn.setOnClickListener(this);
    }

    public void onClick(View v) {
        if (m1.getText().toString().equals("") || m2.getText().toString().equals("")) {
            Toast.makeText(LoginActivity.this, "账号和密码不能为空", Toast.LENGTH_LONG).show();
        } else if (m1.getText().toString().equals("shidesheng") && m2.getText().toString().equals("shidesheng123")) {
            Intent intent = new Intent();
            intent.setClass(LoginActivity.this, MainActivity.class);
            startActivity(intent);
            Toast.makeText(LoginActivity.this, "登录成功", Toast.LENGTH_LONG).show();
        } else {
            Toast.makeText(LoginActivity.this, "账号或密码错误，请重新输入", Toast.LENGTH_LONG).show();
        }
    }
}

